<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Wally The Sentry Bot: Code for Peggy</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Wally The Sentry Bot
   &#160;<span id="projectnumber">0.2</span>
   </div>
   <div id="projectbrief">A silly Arduino project to play with sensors, Xbees and a Peggy 2.0 pegboard</div>
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('group___peggy.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#define-members">Defines</a> &#124;
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a>  </div>
  <div class="headertitle">
<div class="title">Code for Peggy</div>  </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="define-members"></a>
Defines</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gac92ca5ab87034a348decad7ee8d4bd1b"></a><!-- doxytag: member="Peggy::FPS" ref="gac92ca5ab87034a348decad7ee8d4bd1b" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___peggy.html#gac92ca5ab87034a348decad7ee8d4bd1b">FPS</a>&#160;&#160;&#160;80</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">OJ: Trying a bit lower than default 100 to give us more time to do other stuff. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gadc7aa8fbcbc9aa9770faaf7dc8d8bf84"></a><!-- doxytag: member="Peggy::DISP_BUFFER_SIZE" ref="gadc7aa8fbcbc9aa9770faaf7dc8d8bf84" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___peggy.html#gadc7aa8fbcbc9aa9770faaf7dc8d8bf84">DISP_BUFFER_SIZE</a>&#160;&#160;&#160;325</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">25 rows * 13 bytes per row == 325 (13 bytes due to 4bit per pixel =&gt; 12.5B) <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga2134a5a06f0865c945543a1f07eba387"></a><!-- doxytag: member="Peggy::MAX_BRIGHTNESS" ref="ga2134a5a06f0865c945543a1f07eba387" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___peggy.html#ga2134a5a06f0865c945543a1f07eba387">MAX_BRIGHTNESS</a>&#160;&#160;&#160;15</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">More than 4bits color depth doesn't really show on the display. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga4869e3b194f22cc1fb6d8fff1401a587"></a><!-- doxytag: member="Peggy::TWI_SLAVE_ID" ref="ga4869e3b194f22cc1fb6d8fff1401a587" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___peggy.html#ga4869e3b194f22cc1fb6d8fff1401a587">TWI_SLAVE_ID</a>&#160;&#160;&#160;34</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The I2C slave address. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga8a49879af37eda43303df43fbeb1f032"></a><!-- doxytag: member="Peggy::TWI_SRX_ADR_ACK" ref="ga8a49879af37eda43303df43fbeb1f032" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>TWI_SRX_ADR_ACK</b>&#160;&#160;&#160;0x60</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga62efba4b17b779f57b6d97b93e8baaf3"></a><!-- doxytag: member="Peggy::TWI_SRX_ADR_ACK_M_ARB_LOST" ref="ga62efba4b17b779f57b6d97b93e8baaf3" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>TWI_SRX_ADR_ACK_M_ARB_LOST</b>&#160;&#160;&#160;0x68</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga6a3f16e0e8e9489b4e16e4737641cdc9"></a><!-- doxytag: member="Peggy::TWI_SRX_GEN_ACK" ref="ga6a3f16e0e8e9489b4e16e4737641cdc9" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>TWI_SRX_GEN_ACK</b>&#160;&#160;&#160;0x70</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga7b6f732344b34606fc40c580f85729bb"></a><!-- doxytag: member="Peggy::TWI_SRX_GEN_ACK_M_ARB_LOST" ref="ga7b6f732344b34606fc40c580f85729bb" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>TWI_SRX_GEN_ACK_M_ARB_LOST</b>&#160;&#160;&#160;0x78</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gaf50eff2541334d61c22456494294ef46"></a><!-- doxytag: member="Peggy::TWI_SRX_ADR_DATA_ACK" ref="gaf50eff2541334d61c22456494294ef46" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>TWI_SRX_ADR_DATA_ACK</b>&#160;&#160;&#160;0x80</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gae0fc3d2689554a8e4aecf26d197d0970"></a><!-- doxytag: member="Peggy::TWI_SRX_ADR_DATA_NACK" ref="gae0fc3d2689554a8e4aecf26d197d0970" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>TWI_SRX_ADR_DATA_NACK</b>&#160;&#160;&#160;0x88</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga73d95a3380925b993d40d17a4a95c4ff"></a><!-- doxytag: member="Peggy::TWI_SRX_GEN_DATA_ACK" ref="ga73d95a3380925b993d40d17a4a95c4ff" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>TWI_SRX_GEN_DATA_ACK</b>&#160;&#160;&#160;0x90</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gae57858316ede29c95e48984bb7876256"></a><!-- doxytag: member="Peggy::TWI_SRX_GEN_DATA_NACK" ref="gae57858316ede29c95e48984bb7876256" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>TWI_SRX_GEN_DATA_NACK</b>&#160;&#160;&#160;0x98</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gaf8725b19b1de9bdc5d2561109417fbbd"></a><!-- doxytag: member="Peggy::TWI_SRX_STOP_RESTART" ref="gaf8725b19b1de9bdc5d2561109417fbbd" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>TWI_SRX_STOP_RESTART</b>&#160;&#160;&#160;0xA0</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gae6a6800fa8811fea14adfc22736a5715"></a><!-- doxytag: member="Peggy::TWI_NO_STATE" ref="gae6a6800fa8811fea14adfc22736a5715" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>TWI_NO_STATE</b>&#160;&#160;&#160;0xF8</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga0c0d979ddd60bc9d89f1b5c920f4e6bf"></a><!-- doxytag: member="Peggy::TWI_BUS_ERROR" ref="ga0c0d979ddd60bc9d89f1b5c920f4e6bf" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>TWI_BUS_ERROR</b>&#160;&#160;&#160;0x00</td></tr>
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga5686c229bdef50123688ab6cb1404230"></a><!-- doxytag: member="Peggy::ISR" ref="ga5686c229bdef50123688ab6cb1404230" args="(TIMER2_COMPA_vect)" -->
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___peggy.html#ga5686c229bdef50123688ab6cb1404230">ISR</a> (TIMER2_COMPA_vect)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Timer interrupt function to redraw screen from data in frameBuffer (13*24)B. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga8c548751802c5960b3092be28cc56d9f"></a><!-- doxytag: member="Peggy::displayInit" ref="ga8c548751802c5960b3092be28cc56d9f" args="(void)" -->
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___peggy.html#ga8c548751802c5960b3092be28cc56d9f">displayInit</a> (void)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes the display (sets up the SPI interface and interrupt) <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga30f6d25ed642afc09c74c58533cf34c9"></a><!-- doxytag: member="Peggy::initTwiSlave" ref="ga30f6d25ed642afc09c74c58533cf34c9" args="(uint8_t addr)" -->
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___peggy.html#ga30f6d25ed642afc09c74c58533cf34c9">initTwiSlave</a> (uint8_t addr)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes the I2C (2-wire/TWI) interface in slave receiver mode. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___peggy.html#gaa48c1178898c8172cf135d8b02113804">getTwiByte</a> (void)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a single byte from the I2C (2-wire/TWI) interface.  <a href="#gaa48c1178898c8172cf135d8b02113804"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___peggy.html#gab0d9f92e9ab29b24c0e7f1c063d3cf3a">runCommand</a> (uint8_t <a class="el" href="group___mega_man.html#ga4d43e8212bdc9dbee866506f04effcea">cmd</a>)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Runs commands given by header 0xdeadbeef0101x where x is command.  <a href="#gab0d9f92e9ab29b24c0e7f1c063d3cf3a"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___peggy.html#ga7d6a0930e6a255bc0501b603a4bb7406">setPixel</a> (uint8_t x, uint8_t y, uint8_t gradient)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Puts a single pixel in the display.  <a href="#ga7d6a0930e6a255bc0501b603a4bb7406"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___peggy.html#ga2e419873d364d00c07dc51d21954d819">drawLine</a> (uint8_t xa, uint8_t ya, uint8_t xb, uint8_t yb, uint8_t gradient)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Draws a line on the display.  <a href="#ga2e419873d364d00c07dc51d21954d819"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___peggy.html#ga0942784ed06e8efefe2043b889de8afa">soundWave</a> (uint8_t x0, uint8_t y0, uint8_t radius, uint8_t gradient)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Draws a quarter circle on the display.  <a href="#ga0942784ed06e8efefe2043b889de8afa"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___peggy.html#gabfdc7d1e5b4b73e494b47de54f2d3fbb">serviceInputData</a> (void)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets a single byte from I2C and updates state accordingly.  <a href="#gabfdc7d1e5b4b73e494b47de54f2d3fbb"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga840291bc02cba5474a4cb46a9b9566fe"></a><!-- doxytag: member="Peggy::main" ref="ga840291bc02cba5474a4cb46a9b9566fe" args="(void)" -->
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___peggy.html#ga840291bc02cba5474a4cb46a9b9566fe">main</a> (void)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function - initialized the display, I2C, serial and pull-ups. Starts the never returning <a class="el" href="group___peggy.html#gabfdc7d1e5b4b73e494b47de54f2d3fbb" title="Gets a single byte from I2C and updates state accordingly.">serviceInputData()</a> function. <br/></td></tr>
<tr><td colspan="2"><h2><a name="var-members"></a>
Variables</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gaa6be1c183e721e15be4597426e483fcb"></a><!-- doxytag: member="Peggy::frameBuffer" ref="gaa6be1c183e721e15be4597426e483fcb" args="[DISP_BUFFER_SIZE]" -->
uint8_t&#160;</td><td class="memItemRight" valign="bottom"><b>frameBuffer</b> [<a class="el" href="group___peggy.html#gadc7aa8fbcbc9aa9770faaf7dc8d8bf84">DISP_BUFFER_SIZE</a>]</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gae3928a218a62b36f3db24d4716a676c4"></a><!-- doxytag: member="Peggy::currentRowPtr" ref="gae3928a218a62b36f3db24d4716a676c4" args="" -->
uint8_t *&#160;</td><td class="memItemRight" valign="bottom"><b>currentRowPtr</b> = frameBuffer</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga7678898a53843a77e047b755171b9ac0"></a><!-- doxytag: member="Peggy::currentRow" ref="ga7678898a53843a77e047b755171b9ac0" args="" -->
uint8_t&#160;</td><td class="memItemRight" valign="bottom"><b>currentRow</b> = 0</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga38e18697772ce4b5e924e000280f715a"></a><!-- doxytag: member="Peggy::currentBrightness" ref="ga38e18697772ce4b5e924e000280f715a" args="" -->
uint8_t&#160;</td><td class="memItemRight" valign="bottom"><b>currentBrightness</b> = 0</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga120ae5a5f31b7548479805f557e09d17"></a><!-- doxytag: member="Peggy::abortFlag" ref="ga120ae5a5f31b7548479805f557e09d17" args="" -->
volatile boolean&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___peggy.html#ga120ae5a5f31b7548479805f557e09d17">abortFlag</a> = false</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Flag to abort execution if external event demands it. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">PROGMEM prog_uchar&#160;</td><td class="memItemRight" valign="bottom"><b>skull</b> [325]</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">PROGMEM prog_uchar&#160;</td><td class="memItemRight" valign="bottom"><b>radar</b> [325]</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gacb67be2f74a93c412c84b18296aee5e0"></a><!-- doxytag: member="Peggy::a_heart" ref="gacb67be2f74a93c412c84b18296aee5e0" args="[]" -->
PROGMEM prog_uchar&#160;</td><td class="memItemRight" valign="bottom"><b>a_heart</b> []</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gaf471a6e33420f2e227db95c13f85ef6c"></a><!-- doxytag: member="Peggy::smiley_plain" ref="gaf471a6e33420f2e227db95c13f85ef6c" args="[]" -->
PROGMEM prog_uchar&#160;</td><td class="memItemRight" valign="bottom"><b>smiley_plain</b> []</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gac80d397052cce14bdf73bc98d86af0d4"></a><!-- doxytag: member="Peggy::smiley_open" ref="gac80d397052cce14bdf73bc98d86af0d4" args="[]" -->
PROGMEM prog_uchar&#160;</td><td class="memItemRight" valign="bottom"><b>smiley_open</b> []</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga5d644df12f431b51362a2f59f449ad85"></a><!-- doxytag: member="Peggy::smiley_blink" ref="ga5d644df12f431b51362a2f59f449ad85" args="[]" -->
PROGMEM prog_uchar&#160;</td><td class="memItemRight" valign="bottom"><b>smiley_blink</b> []</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga0d3d45881087863a3648a91172e59f57"></a><!-- doxytag: member="Peggy::testpattern" ref="ga0d3d45881087863a3648a91172e59f57" args="[]" -->
PROGMEM prog_uchar&#160;</td><td class="memItemRight" valign="bottom"><b>testpattern</b> []</td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<dl class="copyright"><dt><b>Copyright:</b></dt><dd>Copyright 2012 Ole Jakob Skjelten. All rights reserved.</dd></dl>
<p>This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.</p>
<p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.</p>
<p>You should have received a copy of the GNU General Public License along with this program. If not, see &lt;<a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>&gt;. </p>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="ga2e419873d364d00c07dc51d21954d819"></a><!-- doxytag: member="Peggy.ino::drawLine" ref="ga2e419873d364d00c07dc51d21954d819" args="(uint8_t xa, uint8_t ya, uint8_t xb, uint8_t yb, uint8_t gradient)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="group___peggy.html#ga2e419873d364d00c07dc51d21954d819">drawLine</a> </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>xa</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>ya</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>xb</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>yb</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>gradient</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Draws a line on the display. </p>
<p>Updates the frameBuffer through <a class="el" href="group___peggy.html#ga7d6a0930e6a255bc0501b603a4bb7406" title="Puts a single pixel in the display.">setPixel()</a></p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">uint8_t</td><td>xa horizontal start position (0-24) </td></tr>
    <tr><td class="paramname">uint8_t</td><td>ya vertical start position (0-24) </td></tr>
    <tr><td class="paramname">uint8_t</td><td>xb horizontal end position (0-24) </td></tr>
    <tr><td class="paramname">uint8_t</td><td>yb vertical end position (0-24) </td></tr>
    <tr><td class="paramname">uint8_t</td><td>gradient pixel color (0-15) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="gaa48c1178898c8172cf135d8b02113804"></a><!-- doxytag: member="Peggy.ino::getTwiByte" ref="gaa48c1178898c8172cf135d8b02113804" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t <a class="el" href="group___peggy.html#gaa48c1178898c8172cf135d8b02113804">getTwiByte</a> </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Returns a single byte from the I2C (2-wire/TWI) interface. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>Single byte value (uint8_t result) from the I2C bus </dd></dl>

</div>
</div>
<a class="anchor" id="gab0d9f92e9ab29b24c0e7f1c063d3cf3a"></a><!-- doxytag: member="Peggy.ino::runCommand" ref="gab0d9f92e9ab29b24c0e7f1c063d3cf3a" args="(uint8_t cmd)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="group___peggy.html#gab0d9f92e9ab29b24c0e7f1c063d3cf3a">runCommand</a> </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>cmd</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Runs commands given by header 0xdeadbeef0101x where x is command. </p>
<p>This function moves some common animations and other effects over to the Peggy to save MegaMan from having to transmit a lot of data over the I2C bus for often used effects.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">uint8_t</td><td>cmd Command to execute (1: clear screen, 2: skull animation, 3: radar sweep, 4: "busy" anim, 5: "sound wave" anim) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="gabfdc7d1e5b4b73e494b47de54f2d3fbb"></a><!-- doxytag: member="Peggy.ino::serviceInputData" ref="gabfdc7d1e5b4b73e494b47de54f2d3fbb" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="group___peggy.html#gabfdc7d1e5b4b73e494b47de54f2d3fbb">serviceInputData</a> </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Gets a single byte from I2C and updates state accordingly. </p>
<p>Gets a single byte from I2C and updates state accordingly. Once a full 0xdeadbeef1 header has been received, checks if next byte is 1 (execute local command) or 0, in which case we simply reads a screenful (325B) over I2C and displays the content on screen.</p>
<p>This function never returns from its while(1) loop, but calls <a class="el" href="group___peggy.html#gaa48c1178898c8172cf135d8b02113804" title="Returns a single byte from the I2C (2-wire/TWI) interface.">getTwiByte()</a> to get updated I2C data and calls animation functions as required, who all return here. </p>

</div>
</div>
<a class="anchor" id="ga7d6a0930e6a255bc0501b603a4bb7406"></a><!-- doxytag: member="Peggy.ino::setPixel" ref="ga7d6a0930e6a255bc0501b603a4bb7406" args="(uint8_t x, uint8_t y, uint8_t gradient)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="group___peggy.html#ga7d6a0930e6a255bc0501b603a4bb7406">setPixel</a> </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>y</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>gradient</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Puts a single pixel in the display. </p>
<p>Updates the frameBuffer directly for individual pixels Used by higher level functions, like <a class="el" href="group___peggy.html#ga2e419873d364d00c07dc51d21954d819" title="Draws a line on the display.">drawLine()</a> Will ignore pixels outside of the 0 &lt; x &lt; 25 and 0 &lt; y &lt; 25 range</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">uint8_t</td><td>x x-position (0-24) </td></tr>
    <tr><td class="paramname">uint8_t</td><td>y y-position (0-24) </td></tr>
    <tr><td class="paramname">uint8_t</td><td>gradient pixel color (0-15) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ga0942784ed06e8efefe2043b889de8afa"></a><!-- doxytag: member="Peggy.ino::soundWave" ref="ga0942784ed06e8efefe2043b889de8afa" args="(uint8_t x0, uint8_t y0, uint8_t radius, uint8_t gradient)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="group___peggy.html#ga0942784ed06e8efefe2043b889de8afa">soundWave</a> </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>x0</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>y0</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>radius</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>gradient</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Draws a quarter circle on the display. </p>
<p>Updates the frameBuffer through <a class="el" href="group___peggy.html#ga7d6a0930e6a255bc0501b603a4bb7406" title="Puts a single pixel in the display.">setPixel()</a></p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">uint8_t</td><td>x0 horizontal center position (0-24) </td></tr>
    <tr><td class="paramname">uint8_t</td><td>y0 vertical center position (0-24) </td></tr>
    <tr><td class="paramname">uint8_t</td><td>radius radius (0-24) </td></tr>
    <tr><td class="paramname">uint8_t</td><td>gradient pixel color (0-15) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<hr/><h2>Variable Documentation</h2>
<a class="anchor" id="ga85b1a7ae8458f8d82835d332320e598c"></a><!-- doxytag: member="Peggy.ino::radar" ref="ga85b1a7ae8458f8d82835d332320e598c" args="[325]" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">PROGMEM prog_uchar radar[325]</td>
        </tr>
      </table>
</div>
<div class="memdoc">
<b>Initial value:</b><div class="fragment"><pre class="fragment"> {  
      0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
      0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
      0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
      0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
      0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
      0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
      0,   0,   0,   0,   0, 255, 255, 240,   0,   0,   0,   0,   0,
      0,   0,   0,  15, 255, 240,   0, 255, 255,   0,   0,   0,   0,
      0,   0,  15, 240,   0,   0,   0,   0,   0, 255,   0,   0,   0,
      0,  15, 240,   0,   0,   0,   0,   0,   0,   0, 255,   0,   0,
      0, 240,   0,   0,   0,   0,   0,   0,   0,   0,   0, 240,   0,
     15,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  15,   0,
    240,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 240,
     15,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  15,   0,
      0, 240,   0,   0,   0,   0,   0,   0,   0,   0,   0, 240,   0,
      0,  15,   0,   0,   0,   0,   0,   0,   0,   0,  15,   0,   0,
      0,   0, 240,   0,   0,   0,   0,   0,   0,   0, 240,   0,   0,
      0,   0,  15,   0,   0,   0,   0,   0,   0,  15,   0,   0,   0,
      0,   0,   0, 240,   0,   0,   0,   0,   0, 240,   0,   0,   0,
      0,   0,   0,  15,   0,   0,   0,   0,  15,   0,   0,   0,   0,
      0,   0,   0,   0, 240,   0,   0,   0, 240,   0,   0,   0,   0,
      0,   0,   0,   0,  15,   0,   0,  15,   0,   0,   0,   0,   0,
      0,   0,   0,   0,   0, 240,   0, 240,   0,   0,   0,   0,   0,
      0,   0,   0,   0,   0,  15,  15,   0,   0,   0,   0,   0,   0,
      0,   0,   0,   0,   0,   0, 240,   0,   0,   0,   0,   0,   0
    }
</pre></div>
</div>
</div>
<a class="anchor" id="gadd8ebd573a3e94e4e4fcfc1fbdfabe12"></a><!-- doxytag: member="Peggy.ino::skull" ref="gadd8ebd573a3e94e4e4fcfc1fbdfabe12" args="[325]" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">PROGMEM prog_uchar skull[325]</td>
        </tr>
      </table>
</div>
<div class="memdoc">
<b>Initial value:</b><div class="fragment"><pre class="fragment"> {  
      0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
      0,   0,  15,   0,   0,   0,   0,   0,   0,  15,   0,   0,   0,
      0,   0, 243, 240,   0,   0,   0,   0,   0, 240, 240,   0,   0,
      0,   0, 241,  63,   0,   0,   0,   0,  15,   0, 240,   0,   0,
      0, 255,  17, 240,   0,   0,   0,   0,   0, 241,  31, 240,   0,
     15,   0,   1,  63,   0, 255, 255, 240,  15,  17,  17,  63,   0,
      0, 240, 241,  19, 255,   0,   0,  13, 209,  19, 243, 240,   0,
      0,  15,  15,  31,   0,   0,   0,   0,  14,  63,  15,   0,   0,
      0,   0,   0, 240,  15,   0,   0,  15,   1, 224,   0,   0,   0,
      0,   0,   0, 240, 240, 240,   0, 240, 241, 240,   0,   0,   0,
      0,   0,   0, 240, 240, 255, 255, 240, 241, 208,   0,   0,   0,
      0,   0,  15, 208, 240, 255,  15, 240, 241, 223,   0,   0,   0,
      0,   0,  15,   0, 240,   0, 240,   0, 241,  31,   0,   0,   0,
      0,   0,  15,   0,  15, 255,  15, 255,  17,  31,   0,   0,   0,
      0,   0,   0, 240,   0,   1,  17,  17,  17, 240,   0,   0,   0,
      0,   0,   0,  15, 223,  17,  17,  31, 255,   0,   0,   0,   0,
      0,   0,   0, 243, 211, 223, 223, 211, 241, 240,   0,   0,   0,
      0,  15,  15,  49, 209, 241, 241, 241, 241,  31,  15,   0,   0,
      0, 243, 243,  17, 255,  17,  17,  31, 243,  17, 240, 240,   0,
     15,  49,  17,  31,  15, 255, 255, 255,  15,  49,  16,  15,   0,
      0, 255,  17, 240,   0,   0,   0,   0,   0, 241,  31, 240,   0,
      0,   0, 240,  15,   0,   0,   0,   0,  15,  49, 240,   0,   0,
      0,   0, 240, 240,   0,   0,   0,   0,   0, 243, 240,   0,   0,
      0,   0,  15,   0,   0,   0,   0,   0,   0,  15,   0,   0,   0,
      0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
    }
</pre></div>
</div>
</div>
</div><!-- contents -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div>
  <div id="nav-path" class="navpath">
    <ul>

    <li class="footer">Generated on Thu May 24 2012 00:05:01 for Wally The Sentry Bot by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.6.1 </li>
   </ul>
 </div>


</body>
</html>
